﻿using RecruitStudents.Client.BLL;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Helper;
using RecruitStudents.Utility.Json;
using RecruitStudents.Utility.Model;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RecruitStudents.Client.Base
{
    public partial class Base_SpecialityKindsDetailEditForm_Option : BaseForm
    {
        TB_Sys_SpecialityKinds_Detail model = new TB_Sys_SpecialityKinds_Detail();
        ServiceBase service = new ServiceBase();
        string SpecialityKindsNO = string.Empty;
        public Base_SpecialityKindsDetailEditForm_Option()
        {
            InitializeComponent();
        }
        public Base_SpecialityKindsDetailEditForm_Option(string specialityKindsNO)
        {
            InitializeComponent();
            SpecialityKindsNO = specialityKindsNO;
        }
        public Base_SpecialityKindsDetailEditForm_Option(string specialityKinds_DetailNO, string specialityKindsDetailEditForm_Option, string specialityKindsNO)
        {
            InitializeComponent();
            //txt_SpecialityKinds_DetailNO.Text = specialityKinds_DetailNO;
            txt_SpecialityKinds_DetailName.Text = specialityKindsDetailEditForm_Option;
            SpecialityKindsNO = specialityKindsNO;
            chkSFYX.Checked = true;
            model.IsNewModel = false;
            //txt_SpecialityKinds_DetailNO.Enabled = false;
        }

        private void buttonX2_Click(object sender, EventArgs e)
        {
            //if (string.IsNullOrEmpty(txt_SpecialityKinds_DetailNO.Text))
            //{
            //    DevHelper.ShowInfoMessageBox("请输入专业细分编码！");
            //    return;
            //}
            if (string.IsNullOrEmpty(txt_SpecialityKinds_DetailName.Text))
            {
                DevHelper.ShowInfoMessageBox("请输入专业细分名称！");
                return;
            }
            model.SpecialityKindsNO = SpecialityKindsNO;
            //model.SpecialityKinds_DetailNO = txt_SpecialityKinds_DetailNO.Text;
            model.SpecialityKinds_DetailName = txt_SpecialityKinds_DetailName.Text;
            model.ExamYear = SessionerHelper.SystemYear;
            if (chkSFYX.Checked)
            {
                model.IsActive = "1";
            }
            else
            {
                model.IsActive = "0";
            }
        
            if (service.SaveSpecialityKindsDetail(model))
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
